package com.jandar.controller;

import com.cl.mvc.controller.BaseController;
import com.jandar.entity.ExcelSourceTypeMapping;
import com.jandar.service.ExcelSourceTypeMappingService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@RestController
@RequestMapping("ExcelSourceTypeMapping")
public class ExcelSourceTypeMappingController extends BaseController<ExcelSourceTypeMapping> {
    private final ExcelSourceTypeMappingService excelSourceTypeMappingService;
    public ExcelSourceTypeMappingController(ExcelSourceTypeMappingService service, ExcelSourceTypeMappingService excelSourceTypeMappingService) {
        super(service);
        this.excelSourceTypeMappingService = excelSourceTypeMappingService;
    }

    @GetMapping("generateExcel")
    public void generateExcel(@RequestParam("typeId") Integer typeId, HttpServletResponse response) throws IOException {
        excelSourceTypeMappingService.generateExcel(typeId,response);
    }
}
